package svc

import (
	"github.com/go-redis/redis/v8"
	"gorm.io/gorm"
	"shortUrl/common/cache"
	"shortUrl/common/database"
	"shortUrl/internal/config"
)

type ServiceContext struct {
	Config   config.Config
	Db       *gorm.DB
	CacheDb  *redis.Client
	Business *config.BusinessConf
}

func NewServiceContext(c config.Config, db *config.DataBaseConf, cacheDb *config.CacheConf, business *config.BusinessConf) *ServiceContext {
	return &ServiceContext{
		Config:   c,
		Db:       database.New(db),
		CacheDb:  cache.New(cacheDb),
		Business: business,
	}
}
